# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=hamster
pkgver=2.0.0
pkgrel=17
groups=('blackarch' 'blackarch-exploitation')
pkgdesc='Tool for HTTP session sidejacking.'
arch=('x86_64' 'aarch64')
url='http://hamster.erratasec.com/'
license=('GPL')
depends=('libpcap')
makedepends=(unzip)
source=("http://www.clshack.it/nopaste/$pkgname-$pkgver.zip")
sha512sums=('fc1a3e221399cb451c3a4e41b887421cf5a319db')

prepare() {
  # execvp looks for commands in PATH
  sed -i 's/execv/execvp/g' "$srcdir/hamster/src/pixie.c"
}

build() {
  cd "$pkgname/build/gcc4"

  make

  cd "$srcdir/ferret/build/gcc4"

  make
}

package() {
  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp --no-preserve=ownership "$srcdir"/hamster/bin/* \
    "$pkgdir/usr/share/$pkgname"
  cp --no-preserve=ownership "$srcdir"/ferret/bin/* \
    "$pkgdir/usr/share/$pkgname"

  ln -s "../share/hamster/hamster" "$pkgdir/usr/bin/hamster-http"
  ln -s "../share/hamster/ferret" "$pkgdir/usr/bin/ferret"
}

